package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DbMaterialMapper;
import com.ruoyi.system.domain.DbMaterial;
import com.ruoyi.system.service.IDbMaterialService;

/**
 * 垃圾Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-27
 */
@Service
public class DbMaterialServiceImpl implements IDbMaterialService 
{
    @Autowired
    private DbMaterialMapper dbMaterialMapper;

    /**
     * 查询垃圾
     * 
     * @param id 垃圾主键
     * @return 垃圾
     */
    @Override
    public DbMaterial selectDbMaterialById(Long id)
    {
        return dbMaterialMapper.selectDbMaterialById(id);
    }

    /**
     * 查询垃圾列表
     * 
     * @param dbMaterial 垃圾
     * @return 垃圾
     */
    @Override
    public List<DbMaterial> selectDbMaterialList(DbMaterial dbMaterial)
    {
        return dbMaterialMapper.selectDbMaterialList(dbMaterial);
    }

    /**
     * 新增垃圾
     * 
     * @param dbMaterial 垃圾
     * @return 结果
     */
    @Override
    public int insertDbMaterial(DbMaterial dbMaterial)
    {
        dbMaterial.setCreateTime(DateUtils.getNowDate());
        return dbMaterialMapper.insertDbMaterial(dbMaterial);
    }

    /**
     * 修改垃圾
     * 
     * @param dbMaterial 垃圾
     * @return 结果
     */
    @Override
    public int updateDbMaterial(DbMaterial dbMaterial)
    {
        dbMaterial.setUpdateTime(DateUtils.getNowDate());
        return dbMaterialMapper.updateDbMaterial(dbMaterial);
    }

    /**
     * 批量删除垃圾
     * 
     * @param ids 需要删除的垃圾主键
     * @return 结果
     */
    @Override
    public int deleteDbMaterialByIds(Long[] ids)
    {
        return dbMaterialMapper.deleteDbMaterialByIds(ids);
    }

    /**
     * 删除垃圾信息
     * 
     * @param id 垃圾主键
     * @return 结果
     */
    @Override
    public int deleteDbMaterialById(Long id)
    {
        return dbMaterialMapper.deleteDbMaterialById(id);
    }
}
